let express = require("express")

let {
    createProxyMiddleware: proxy
} = require("http-proxy-middleware");

let app = express();


//YSL
app.use(
    "/rest",
    proxy({
        target: "https://www.ysl.cn/",
        changeOrigin: true,
    })
);

//服务端
app.use(
    "/api",
    proxy({
        target:"http://localhost:8080/",
        changeOrigin:true,
        pathRewrite:{
            "^/api": "/",
        },
    })
);
app.use(express.static("./"));

app.listen(8181, () => {
    console.log("running port 8181");
})